package userapi

import (
	"github.com/gin-gonic/gin"
	"interview/models"
	"interview/pkg/cache_service"
)

func GetCurrentUser(c *gin.Context) models.User {
	s := cache_service.NewRedisService(c)
	u, _ := c.Get("user")
	user, _ := u.(models.User)
	newUser, _ := s.GetUserInfo(user.ID)
	return *newUser
}
